package com.lwlean.test.twilio;

import com.twilio.twiml.*;
import com.twilio.twiml.Number;

import java.util.Arrays;

/**
 * Created by lean on 2017/7/20.
 */
public class NumberExample {

    public static void main(String[] args) {
        Number number = new Number.Builder("+8613521086184")
                .statusCallback("http://lilongwei2.kiigee.com/test/receiveFallCall")
                .statusCallbackMethod(Method.POST).statusCallbackEvents(Arrays
                        .asList(Event.INITIATED, Event.RINGING, Event.ANSWERED, Event
                                .COMPLETED))
                .build();
        Dial dial = new Dial.Builder().number(number).build();
//        Say say = new Say.Builder("hello pengwei,").build();
        Say say = new Say.Builder("贾鹏伟，这是挂断提示").voice(Say.Voice.WOMAN)
                .language(Language.ZH_CN).build();
        VoiceResponse response = new VoiceResponse.Builder().dial(dial)
                .say(say).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }

}
